<?php
    require 'common.php';
    
    // error check
    if(!isset($_POST['pw']))
        throw new Exception('Bad request.');
    if($_POST['pw'] != config('ROOT_PASSWORD')) {
        message(lang('BAD_PASSWORD'), 
                'reset.php', 
                lang('BACK_TO_RESET'));
        exit();
    }
    
    // Reset
	$db = new Database();
    $db->query('DROP TABLE IF EXISTS '.
        config('DB_PREFIX').'users, '.
        config('DB_PREFIX').'blocks, '.
        config('DB_PREFIX').'questions, '.
        config('DB_PREFIX').'answers, '.
        config('DB_PREFIX').'misc');
    
    // Reset sucessfull
    message(lang('RESET_SUCCESSFULL'), 
            'install.php', 
            lang('GOTO_INSTALL'));
?>